home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93c.txt
/
000014_icon-group-sender _Tue Jul 20 11:22:30 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1994-02-02
|
1KB
Received: by cheltenham.cs.arizona.edu; Tue, 20 Jul 1993 13:44:22 MST
Message-Id: <9307201822.AA19766@hpclpax.cup.hp.com>
To: Paul_Abrahams@MTS.cc.Wayne.edu
Cc: icon-group@cs.arizona.edu
Subject: Re: Mystery about "every"
Date: Tue, 20 Jul 93 11:22:30 -0700
From: Cary Coutant <cary@hpclpax.cup.hp.com>
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
> every retval := 8 * retval + ord(!s) - ord("0")
>
> Now the output of the program is 3 (the last digit), not 83.
>
> Can anyone explain to me what's going on?
Try reversing the operands of the "+" operation:
every retval := ord(!s) - ord("0") + 8 * retval
Your problem was that the every was resuming the expression
from the last suspended generator, so "8 * retval" was never
being reevaluated.
In situations like this, it's sometimes useful to replace a
built-in operator with your own procedure, so you can see
what's going on by setting TRACE. For example:
every retval := add(8 * retval, ord(!s) - ord("0"))
Cary Coutant
Hewlett-Packard
California Language Lab